import request from '@/utils/request'

export function ConsumerList(query) {
  return request({
    url: '/kong/consumer/list',
    method: 'get',
    params: query
  })
}

export function addConsumer(data) {
  return request({
    url: '/kong/consumer/add',
    method: 'post',
    data: data
  })
}


export function updateConsumer(data) {
  return request({
    url: '/kong/consumer/update/'+data.id,
    method: 'post',
    data: data
  })
}

export function deleteConsumer(id) {
  return request({
    url: '/kong/consumer/delete/'+id,
    method: 'post',
  })
}


export function getConsumerCredential(id,name) {
  return request({
    url: '/kong/consumer/credential/'+id+"/"+name,
    method: 'get',
  })
}

export function addConsumerCredential(id,name,data) {
  return request({
    url: '/kong/consumer/credential/add/'+id+"/"+name,
    method: 'post',
    data: data
  })
}

export function deleteConsumerCredential(id,name,entityId) {
  return request({
    url: '/kong/consumer/credential/delete/'+id+"/"+name+"/"+entityId,
    method: 'post',
  })
}